package day05_AnonymousInnerClassAndLambda;

public class Calculator {
    public static void main(String[] args) {
        cal cal = (a, b) -> a - b;//省略写法，原为： useCalculator((int a, int b) -> {return a+b;});
        useCalculator(cal);
    }

    public static void useCalculator(cal calculator) {
        int result = calculator.calc(10, 20);
        System.out.println(result);
    }
}

interface cal {
    int calc(int a, int b);
}